<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        img{
            width: 200px;
        }
    </style>
</head>
<body>
    <div id="app">
        <button @click="add">+</button>
        <span>{{number}}</span>
        <button @click="sub">-</button>

        <img :src="url" alt="">
        <button @click="one">1</button>
        <button @click="two">2</button>
        <button @click="three">3</button>
    </div>
    <script src="js/vue.js"></script>
    <script>
        new Vue({
            data:{
                number:0,
                url:"img/1.jpg"
            },
            methods:{
                add(){
                    this.number++
                },
                sub(){
                    if(this.number>0){
                       this.number-- 
                    }
                },
                one(){
                    this.url = "img/1.jpg"
                },
                two(){
                    this.url = "img/2.jpg"
                },
                three(){
                    this.url = "img/3.jpg"
                },
            }
        }).$mount("#app")
    </script>
</body>
</html>